package cn.sofwin.day0203.homework.H1;

import java.util.Scanner;

public class Register {

    static Scanner sc = new Scanner(System.in);

    public static boolean regist(){
        System.out.print("请输入用户名：");
        String userName = sc.next();
        System.out.print("请输入密码：");
        String password = sc.next();
        System.out.print("请再次输入密码：");
        String password1 = sc.next();

        if (!password.equals(password1)) {
            System.out.println("两次输入的密码不相同！");
            return false;
        }
        if (password.length() < 6 && userName.length() < 3) {
            System.out.println("用户名长度不能小于3，密码长度不能小于6！");
            return false;
        }

        User user = new User(userName, password);
        return true;
    }
    public static void main(String[] args) {
        System.out.println("***欢迎进入注册系统***\n");
        while (!regist()){}
        System.out.println("注册成功！请牢记用户名和密码。");
    }
}
